121. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2023-07-12 04:42:39 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

121.1 Files compared

#LocationFileLast Modified
1Porto v4.0.5/Theme Files/Porto Theme/app/code/Smartwave/Filterproducts/Block/HomeFeaturedList.php2019-10-10 11:01:04 +0000
2Porto v4.0.6/Theme Files/Porto Theme/app/code/Smartwave/Filterproducts/Block/HomeFeaturedList.php2023-06-14 14:29:28 +0000

121.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged2174
Changed12
Inserted00
Removed00

121.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

121.4 Active regular expressions

No regular expressions were active.

121.5 Comparison detail

1 <?php 1 <?php
2  2 
3 namespace Smartwave\Filterproducts\Block\Home; 3 namespace Smartwave\Filterproducts\Block\Home;
4  4 
5 use Magento\Catalog\Api\CategoryRepositoryInterface; 5 use Magento\Catalog\Api\CategoryRepositoryInterface;
6  6 
7 class FeaturedList extends \Magento\Catalog\Block\Product\ListProduct { 7 class FeaturedList extends \Magento\Catalog\Block\Product\ListProduct {
8  8 
9     protected $_collection; 9     protected $_collection;
10  10 
11     protected $categoryRepository; 11     protected $categoryRepository;
12  12 
13     protected $_resource; 13     protected $_resource;
14  14 
15     public function __construct( 15     public function __construct(
16             \Magento\Catalog\Block\Product\Context $context, 16             \Magento\Catalog\Block\Product\Context $context,
17             \Magento\Framework\Data\Helper\PostHelper $postDataHelper, 17             \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
18             \Magento\Catalog\Model\Layer\Resolver $layerResolver, 18             \Magento\Catalog\Model\Layer\Resolver $layerResolver,
19             CategoryRepositoryInterface $categoryRepository, 19             CategoryRepositoryInterface $categoryRepository,
20             \Magento\Framework\Url\Helper\Data $urlHelper, 20             \Magento\Framework\Url\Helper\Data $urlHelper,
21             \Magento\Catalog\Model\ResourceModel\Product\Collection $collection, 21             \Magento\Catalog\Model\ResourceModel\Product\Collection $collection,
22             \Magento\Framework\App\ResourceConnection $resource, 22             \Magento\Framework\App\ResourceConnection $resource,
23             array $data = [] 23             array $data = []
24     ) { 24     ) {
25         $this->categoryRepository = $categoryRepository; 25         $this->categoryRepository = $categoryRepository;
26         $this->_collection = $collection; 26         $this->_collection = $collection;
27         $this->_resource = $resource; 27         $this->_resource = $resource;
28  28 
29         parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data); 29         parent::__construct($context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data);
30     } 30     }
31  31 
32     protected function _getProductCollection() { 32     protected function _getProductCollection() {
33         return $this->getProducts(); 33         return $this->getProducts();
34     } 34     }
35  35 
36     public function getProducts() { 36     public function getProducts() {
37         $count = $this->getProductCount(); 37         $count = $this->getProductCount();
38         $category_id = $this->getData("category_id"); 38         $category_id = $this->getData("category_id");
39         $collection = clone $this->_collection; 39         $collection = clone $this->_collection;
40         $collection->clear()->getSelect()->reset(\Magento\Framework\DB\Select::WHERE)->reset(\Magento\Framework\DB\Select::ORDER)->reset(\Magento\Framework\DB\Select::LIMIT_COUNT)->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET)->reset(\Magento\Framework\DB\Select::GROUP); 40         $collection->clear()->getSelect()->reset(\Magento\Framework\DB\Select::WHERE)->reset(\Magento\Framework\DB\Select::ORDER)->reset(\Magento\Framework\DB\Select::LIMIT_COUNT)->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET)->reset(\Magento\Framework\DB\Select::GROUP);
41  41 
42         if(!$category_id) { 42         if(!$category_id) {
43             $category_id = $this->_storeManager->getStore()->getRootCategoryId(); 43             $category_id = $this->_storeManager->getStore()->getRootCategoryId();
44         } 44         }
45         $category = $this->categoryRepository->get($category_id); 45         $category = $this->categoryRepository->get($category_id);
46         if(isset($category) && $category) { 46         if(isset($category) && $category) {
47             $collection->addMinimalPrice() 47             $collection->addMinimalPrice()
48                 ->addFinalPrice() 48                 ->addFinalPrice()
49                 ->addTaxPercents() 49                 ->addTaxPercents()
50                 ->addAttributeToSelect('name') 50                 ->addAttributeToSelect('name')
51                 ->addAttributeToSelect('image') 51                 ->addAttributeToSelect('image')
52                 ->addAttributeToSelect('small_image') 52                 ->addAttributeToSelect('small_image')
53                 ->addAttributeToSelect('thumbnail') 53                 ->addAttributeToSelect('thumbnail')
54                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes()) 54                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
55                 ->addUrlRewrite() 55                 ->addUrlRewrite()
56                 ->addAttributeToFilter('sw_featured', 1, 'left') 56                 ->addAttributeToFilter('sw_featured', 1, 'left')
57                 ->addCategoryFilter($category); 57                 ->addCategoryFilter($category);
58         } else { 58         } else {
59             $collection->addMinimalPrice() 59             $collection->addMinimalPrice()
60                 ->addFinalPrice() 60                 ->addFinalPrice()
61                 ->addTaxPercents() 61                 ->addTaxPercents()
62                 ->addAttributeToSelect('name') 62                 ->addAttributeToSelect('name')
63                 ->addAttributeToSelect('image') 63                 ->addAttributeToSelect('image')
64                 ->addAttributeToSelect('small_image') 64                 ->addAttributeToSelect('small_image')
65                 ->addAttributeToSelect('thumbnail') 65                 ->addAttributeToSelect('thumbnail')
66                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes()) 66                 ->addAttributeToSelect($this->_catalogConfig->getProductAttributes())
67                 ->addUrlRewrite()  67                 ->addUrlRewrite()
68                 ->addAttributeToFilter('sw_featured', 1, 'left'); 68                 ->addAttributeToFilter('sw_featured', 1, 'left');
69         } 69         }
70  70 
71         $collection->getSelect() 71         $collection->getSelect()
72             ->order('rand()') 72             ->order('rand()')
73             ->limit($count); 73             ->limit($count);
74  74 
75         return $collection; 75         return $collection;
76     } 76     }
77  77 
78     public function getLoadedProductCollection() { 78     public function getLoadedProductCollection() {
79         return $this->getProducts(); 79         return $this->getProducts();
80     } 80     }
81  81 
82     public function getProductCount() { 82     public function getProductCount() {
83         $limit = $this->getData("product_count"); 83         $limit = $this->getData("product_count");
84         if(!$limit) 84         if(!$limit)
85             $limit = 10; 85             $limit = 10;
86         return $limit; 86         return $limit;
87     } 87     }
88 } 88 }